<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>otherWindow</title>
</head>

<body>
    <h1>隔壁窗口</h1>
    <h3>通过window.opener改变主窗口颜色</h3>
    <button id="turnGreen">变绿</button>
    <button id="turnBlue">变蓝</button>
    <button id="turnPurple">变紫</button>

    <script type="text/javascript" src="../../source/jquery-3.2.1.min.js"></script>
    
    <script type="text/javascript">
    $('#turnGreen').on('click', function() {
        window.opener.document.bgColor = 'green';
    });
    $('#turnBlue').on('click', function() {
        window.opener.document.bgColor = 'blue';
    });
    $('#turnPurple').on('click', function() {
        window.opener.document.bgColor = 'purple';
    });
    </script>
</body>

</html>